package in.waffl.fairycake;

import java.awt.EventQueue;
import java.lang.reflect.InvocationTargetException;



public class Main {
	public static final String gameName = "Fairycake";
	public static final int FPS = 50;
	final static PollingThread poller = new PollingThread();
	private static Canvas canvas = null;
	private static LogicExecutor logicExecutor;
	public static void main(String[] args) throws InterruptedException, InvocationTargetException {
		final int level = 1;
		EventQueue.invokeAndWait(new Runnable() {
			@Override
			public void run() {
				final MainWindow frame = new MainWindow();
				frame.setVisible(true);
				frame.addKeyListener(Main.poller);
				canvas  = frame.getCanvas();
			}
		});
		setLogicExecutor(new LogicExecutor(level, canvas));
		EventQueue.invokeLater(getLogicExecutor());
	}
	public static LogicExecutor getLogicExecutor() {
		return logicExecutor;
	}
	public static void setLogicExecutor(LogicExecutor logicExecutor) {
		Main.logicExecutor = logicExecutor;
	}
}
